<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<fmt:setBundle basename="com.kolon.config.properties.config" var="config" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="${requestScope.contextPath}/css/mngr/common.css" rel="stylesheet" type="text/css" />
<title><fmt:message bundle="${config}" key="mngr.title" /></title>
<script type="text/javascript" src="${requestScope.contextPath}/js/jquery-ui-1.8.14.custom/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="${requestScope.contextPath}/js/common.js"></script>
<script>
function deptAppsWrite(url) {
	if (confirm('팀을 등록하시겠습니까? \n이 서비스는 등록된 팀에게만 보여지게 됩니다.')) {
		location.href=url;
	}
}

function deptAppsDelete(url) {
	if (confirm('선택하신 팀을 삭제하시겠습니까?')) {
		location.href=url;
	}
}

function deptAppsAllDelete() {
	if (confirm('팀을 모두삭제하시겠습니까?')) {
		location.href=url;
	}
}
</script>
</head>
<body>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
				<tr>  
					<td align="left"><strong>1. 회사 선택</strong></td>
				</tr>
				<form action="${requestScope.contextPath}/business/mngr/service/deptAppsCpyWrite.do" method="post">
				<tr>
					<td>
						<input type="hidden" name="servNo" value="${servNo}" />
						<select name="cpyCd" style="width: 300px;">
							<c:forEach items="${cpyList}" var="map" varStatus="state">
							<option value="${map.CompanyCD}">${map.companyname}</option>
							</c:forEach>
						</select>
						<input type="submit" value="추가" />
					</td>
				</tr>
				</form>
				<tr>
					<td height="30"></td>
				</tr>
				<tr>  
					<td align="left"><strong>2. 팀 선택</strong></td>
				</tr>
				<form action="" method="get">
				<tr>
					<td align="left">
						<table border=0 width="100%" class="unnamed2">
						<tr>
							<td align="right" width="*">
							<input type="hidden" name="servNo" value="${servNo}" />
							<select name="schTp">
								<option value="cNm" <c:if test="${schTp eq 'cNm'}">selected="selected"</c:if>>회사명</option>
								<option value="tNm" <c:if test="${schTp eq 'tNm'}">selected="selected"</c:if>>팀명</option>
							</select>
							<input type=text name="schTxt" size="12" value="${schTxt}" /> <input type="submit" value="찾기" />&nbsp;
							</td>
						</tr>
						</table>
					</td>
				</tr>
				</form>
				<tr bgcolor=ffffff>
					<td>
						<table width='100%' border="0" cellpadding="0" cellspacing='5' bgcolor='F0F9FC'>
							<tr> 
								<td>
								
								<table width='100%' border="0" cellpadding='5' cellspacing='1' bgcolor='BED7DF'>
								<tr bgcolor=E7F6FB>	
									<td align="center" width="10%"><font color=1CABD4><b>순 번</b></font></td>
									<td align="center" width="45%"><font color=1CABD4><b>회사 명</b></font></td>
									<td align="center" width="45%"><font color=1CABD4><b>팀명</b></font></td>
								</tr>
								<c:choose>
								<c:when test="${fn:length(list) == 0}">
								<tr>
									<td bgcolor="FFFFFF" align="center" valign="middle" height="50" colspan="3" class="unnamed1">팀정보가 존재하지 않습니다.</td>
								</tr>
								</c:when>
								<c:otherwise>
								<c:forEach items="${list}" var="map" varStatus="state">
								<tr bgcolor="FFFFFF">
									<td align="center">${totCnt - ((page-1) * recordPerPage) - state.index}</td>
									<td align="center"><a href="${requestScope.contextPath}/business/mngr/service/deptAppsWrite.do?servNo=${servNo}&amp;cpyCd=${map.CompanyCD}&amp;grpCd=${map.GroupCD}" onclick="deptAppsWrite(this.href); return false;">${map.companyname}</a></td>
									<td align="center"><a href="${requestScope.contextPath}/business/mngr/service/deptAppsWrite.do?servNo=${servNo}&amp;cpyCd=${map.CompanyCD}&amp;grpCd=${map.GroupCD}" onclick="deptAppsWrite(this.href); return false;">${map.GroupName}</a></td>
								</tr>
								</c:forEach>
								<tr><td colspan="5" bgcolor=ffffff align="center">${pageHtml}</td></tr>
								</c:otherwise>
								</c:choose>
							</table>
						</td>
					</tr>
				</table>
					</td>
				</tr>
			</table>
			<br/><br/>
			<table border=0 cellpadding=0 cellspacing=0 width=100% align="center">
				<tr>  
					<td align="left">
						<table border=0 width="100%" class="unnamed2">
						<tr>
							<td width="50%" align="left"><strong>- 선택된 팀 목록</strong></td>
							<td width="50%" align="right"><a href="${requestScope.contextPath}/business/mngr/service/deptAppsAllDelete.do?servNo=${servNo}" onclick="deptAppsAllDelete(this.href); return false;">모두삭제</a></td>
						</tr>
						</table>
					</td>
				</tr>
				<tr bgcolor=ffffff>
					<td>
						<div style="height: 400px; overflow: auto;">
						<table width='95%' border="0" cellpadding="0" cellspacing='5' bgcolor='F0F9FC'>
							<tr> 
								<td>
								
								<table width='100%' border="0" cellpadding='5' cellspacing='1' bgcolor='BED7DF'>
								<tr bgcolor=E7F6FB>	
									<td align="center" width="10%"><font color=1CABD4><b>순 번</b></font></td>
									<td align="center" width="40%"><font color=1CABD4><b>회사 명</b></font></td>
									<td align="center" width="40%"><font color=1CABD4><b>팀명</b></font></td>
									<td align="center" width="10%"><font color=1CABD4><b>삭제</b></font></td>
								</tr>
								<c:choose>
								<c:when test="${fn:length(teamList) == 0}">
								<tr>
									<td bgcolor="FFFFFF" align="center" valign="middle" height="50" colspan="4" class="unnamed1">노출될 팀정보가 존재하지 않습니다.</td>
								</tr>
								</c:when>
								<c:otherwise>
								<c:forEach items="${teamList}" var="map" varStatus="state">
								<tr bgcolor="FFFFFF">
									<td align="center">${state.index+1}</td>
									<td align="center">${map.companyname}</td>
									<td align="center">${map.GroupName}</td>
									<td align="center"><a href="${requestScope.contextPath}/business/mngr/service/deptAppsDelete.do?servNo=${servNo}&amp;servTeamNo=${map.SERV_TEAM_NO}" onclick="deptAppsDelete(this.href); return false;">삭제</a></td>
								</tr>
								</c:forEach>
								</c:otherwise>
								</c:choose>
							</table>
							
						</td>
					</tr>
				</table>
				</div>
					</td>
				</tr>
			</table>
	</body>
</html>